package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.request.PhoneRechargeRequest;
import com.ytjj.qmyx.admin.service.PhoneRechargeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *
 *
 * @Version: 1.0
 *
 * 手机充值 管理
 */
@RestController
@RequestMapping("/phoneRecharge")
public class PhoneRechargeController {

    @Resource
    private PhoneRechargeService phoneRechargeService;

    @RequiresPermissions("phoneRecharge:list")
    @PostMapping("/list")
    @OperLog(operModule = "手机充值管理", operDesc = "充值列表", operType = SysLogConstants.OPERATION_SELECT)
    public CommonResult getList(@RequestBody PhoneRechargeRequest phoneRechargeRequest) {
        return CommonResult.success(phoneRechargeService.getList(phoneRechargeRequest));
    }

    @RequiresPermissions("phoneRecharge:refund")
    @PostMapping("/refund")
    public CommonResult refund(@RequestBody PhoneRechargeRequest phoneRechargeRequest) {
        return CommonResult.success(phoneRechargeService.returnPhoneRecharge(phoneRechargeRequest.getId()));
    }

}
